<template>
	<view>
		<u-tabbar v-if="tabbar.length > 0" :value="current" :list="tabbar" :active-color="'#10beca'" :inactive-color="'#6c757d'"
			:mid-button="false" @change="tabChange">
		</u-tabbar>
		
		<!-- 选择切换 -->
		<u-popup v-model="show" mode="bottom" border-radius="14">
			<identities-list @hide="hideList"></identities-list>
		</u-popup>
	</view>
</template>

<script>
	import {
		mapState,
	} from 'vuex';
	export default {
		name:"common-tabbar",
		props:{
			current: {
				type: Number,
				default(){
					return 0
				}
			}
		},
		data() {
			return {
				tabbar: [
					{
						iconPath: "home",
						selectedIconPath: "home-fill",
						text: '首页',
						customIcon: false,
					},
					{
						iconPath: "grid",
						selectedIconPath: "grid-fill",
						text: '工作台',
						customIcon: false,
					},
					// {
					// 	iconPath: "list-dot",
					// 	selectedIconPath: "list-dot",
					// 	text: '切换身份',
					// 	midButton: true,
					// 	slotMid: true,
					// 	customIcon: false,
					// },
					{
						iconPath: "account",
						selectedIconPath: "account-fill",
						text: '我的',
						customIcon: false,
					}
				],
				show: false
			};
		},
		computed: {
			...mapState({
				userdetail: state => state.userdetail
			})
		},
		methods:{
			tabChange(e) {
				if (e == 0) {
					uni.reLaunch({
						url: '/pages/brother/index/index'
					})
				} else if (e == 1) {
					uni.reLaunch({
						url: '/pages/brother/workbenches/workbenches'
					})
				} else if (e == 2) {
					uni.reLaunch({
						url: '/pages/brother/my/my'
					})
				}
			},
			hideList(value){
				this.show = value
			}
		}
	}
</script>

<style lang="scss" scoped>

</style>